package net.asgarli.ivault.api;

import java.io.IOException;

/**
 * Represents user supplied, thus empty KeySupplyMethod.
 * @author Elchin Asgarli
 * @version 0.1
 * @since 0.1
 */
public class UserKeySupply extends KeySupplyMethod {

	private static final long serialVersionUID = 1L;

	/**
	 * Returns 0, since there is nothing to parse.
	 */
	@Override
	public int getInitialParseByteSize() {
		return 0;
	}

	/**
	 * Returns null as a key. 
	 */
	@Override
	public byte[] getKey() {
		return null;
	}

	/**
	 * Does nothing, since this key supply method has nothing to store.
	 */
	@Override
	public void restoreFromByteArray(byte[] bytes) throws IOException {
	}

	/**
	 * Returns an empty array since this key supply method has nothing inside it.
	 */
	@Override
	public byte[] saveToByteArray() throws IOException {
		return new byte[0];
	}
}
